def powermod(a, b, m):
    """
    Returns the  the modular exponentiation a^b mod m.

    Args:
        a,b (integers) c(integers and c>=0)

    Returns:
        the modular exponentiation a^b mod m(integers)
    """

    if isinstance(a, int) and isinstance(b, int) and isinstance(m, int) and m >= 0:
        if m == 1:
            return 0
        c = 1
        for i in range(b):
            c = (c * a) % m
        return c
    else:
        # Raise TypeError for unsupported input types
        raise TypeError("Input type not supported.")


# Test case 1
assert powermod(2, 3, 5) == 3

# Test case 2
assert powermod(3, 4, 7) == 4

# Test case 3
assert powermod(4, 13, 497) == 445

# Test case 4
assert powermod(12, 5, 7) == 3

# Test case 5
assert powermod(0, 0, 1) == 0

